<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Dom Ready ?</title>
    <script type="text/javascript">
      //document.getElementById('header').style.color = "red";//dom not ready
    </script>
  </head>
  <body>
    <h1 id="header">h1元素</h1>
    <script type="text/javascript">
      window.onload = function() {
        console.log("dom is ready");
      }
    </script>
  </body>
</html>
